export default class StrUtil {
  static createUniqueString() {
    const timestamp = +new Date() + ''
    const randomNum = (1 + Math.random()) * 65536
    return (+(randomNum + timestamp)).toString(32)
  }

  static split(str, sep = ',') {
    return (str || '').split(sep)
  }

  static fLenB(character) {
    let count = 0
    for (let i = 0; i < character.length; i++) {
      if ((character.charCodeAt(i) > 0 && character.charCodeAt(i) < 127) || (character.charCodeAt(i) > 65376 && character.charCodeAt(i) < 65440)) {
        count++
      } else {
        count += 2
      }
    }
    return count
  }
}
